home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-I386 / IDE.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  124 lines

  1. /*
  2.  *  linux/include/asm-i386/ide.h
  3.  *
  4.  *  Copyright (C) 1994-1996  Linus Torvalds & authors
  5.  */
  6.  
  7. /*
  8.  *  This file contains the i386 architecture specific IDE code.
  9.  */
  10.  
  11. #ifndef __ASMi386_IDE_H
  12. #define __ASMi386_IDE_H
  13.  
  14. #ifdef __KERNEL__
  15.  
  16. typedef unsigned short ide_ioreg_t;
  17.  
  18. #ifndef MAX_HWIFS
  19. #define MAX_HWIFS    6
  20. #endif
  21.  
  22. #define ide__sti()    __sti()
  23.  
  24. static __inline__ int ide_default_irq(ide_ioreg_t base)
  25. {
  26.     switch (base) {
  27.         case 0x1f0: return 14;
  28.         case 0x170: return 15;
  29.         case 0x1e8: return 11;
  30.         case 0x168: return 10;
  31.         case 0x1e0: return 8;
  32.         case 0x160: return 12;
  33.         default:
  34.             return 0;
  35.     }
  36. }
  37.  
  38. static __inline__ ide_ioreg_t ide_default_io_base(int index)
  39. {
  40.     switch (index) {
  41.         case 0:    return 0x1f0;
  42.         case 1:    return 0x170;
  43.         case 2: return 0x1e8;
  44.         case 3: return 0x168;
  45.         case 4: return 0x1e0;
  46.         case 5: return 0x160;
  47.         default:
  48.             return 0;
  49.     }
  50. }
  51.  
  52. static __inline__ void ide_init_hwif_ports (ide_ioreg_t *p, ide_ioreg_t base, int *irq)
  53. {
  54.     ide_ioreg_t port = base;
  55.     int i = 8;
  56.  
  57.     while (i--)
  58.         *p++ = port++;
  59.     *p++ = base + 0x206;
  60.     if (irq != NULL)
  61.         *irq = 0;
  62. }
  63.  
  64. typedef union {
  65.     unsigned all            : 8;    /* all of the bits together */
  66.     struct {
  67.         unsigned head        : 4;    /* always zeros here */
  68.         unsigned unit        : 1;    /* drive select number, 0 or 1 */
  69.         unsigned bit5        : 1;    /* always 1 */
  70.         unsigned lba        : 1;    /* using LBA instead of CHS */
  71.         unsigned bit7        : 1;    /* always 1 */
  72.     } b;
  73.     } select_t;
  74.  
  75. static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
  76.             unsigned long flags, const char *device, void *dev_id)
  77. {
  78.     return request_irq(irq, handler, flags, device, dev_id);
  79. }            
  80.  
  81. static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
  82. {
  83.     free_irq(irq, dev_id);
  84. }
  85.  
  86. static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
  87. {
  88.     return check_region(from, extent);
  89. }
  90.  
  91. static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name)
  92. {
  93.     request_region(from, extent, name);
  94. }
  95.  
  96. static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent)
  97. {
  98.     release_region(from, extent);
  99. }
  100.  
  101. /*
  102.  * The following are not needed for the non-m68k ports
  103.  */
  104. static __inline__ int ide_ack_intr (ide_ioreg_t status_port, ide_ioreg_t irq_port)
  105. {
  106.     return(1);
  107. }
  108.  
  109. static __inline__ void ide_fix_driveid(struct hd_driveid *id)
  110. {
  111. }
  112.  
  113. static __inline__ void ide_release_lock (int *ide_lock)
  114. {
  115. }
  116.  
  117. static __inline__ void ide_get_lock (int *ide_lock, void (*handler)(int, void *, struct pt_regs *), void *data)
  118. {
  119. }
  120.  
  121. #endif /* __KERNEL__ */
  122.  
  123. #endif /* __ASMi386_IDE_H */
  124.